package TUILayer;

import ModelLayer.*;
import ControlLayer.*;
import java.util.*;
public class Menu 
{
    Scanner keyboard = new Scanner(System.in);
    private MenuFriends friends;
    private MenuDVDs dvds;
    private MenuLoans loans;
    public Menu ()
    {
        friends = new MenuFriends();
        dvds = new MenuDVDs();
        loans = new MenuLoans();
        mainMenuStart();
        
    }
    
    public void mainMenuStart()
    {
        boolean exit = false;
        while(!exit)
        {
            int choise = writeMainMenu();
            if(choise == 1)
            {
                friends.friendsMenu();
            }
            else 
            {
                if(choise == 2)
                {
                    dvds.dvdsMenu();
                }
                else 
                {
                    if(choise == 3)
                    {
                        loans.loansMenu();
                    }
                    else 
                    {
                        if(choise == 4)
                        {
                            writeEnd();
                            exit = true;
                        }
                        else
                        {
                            System.out.println("Command not valid");
                        }
                    }
                } 
            }
        }
    }
    
    private int writeMainMenu()
    {
        System.out.println(" ");
        System.out.println("============================");
        System.out.println("|   MENU SELECTION         |");
        System.out.println("============================");
        System.out.println("| Options:                 |");
        System.out.println("|        1. Friends        |");
        System.out.println("|        2. DVDs           |");
        System.out.println("|        3. Loans          |");
        System.out.println("|        4. Exit           |");
        System.out.println("============================");
        System.out.println("     Make your choise: "     );
        
        int choise = keyboard.nextInt();
        
        return choise;
    }
    
    private void writeEnd()
    {
        System.out.println(" The System is shuting down.");
    }  
}


      
     